#! /bin/sh
#
# This file contains anti-admin-hack code.
# Please don't mail publically about it.
# $Id: sums 499 2003-06-11 00:48:41Z r33d $

trap "test" 1 2 3 13 14 15 
if [ ! -f .checksums ] ; then
  OLDS=`find ../.. -type d -name 'ircu*' -print 2>/dev/null`
  if [ ! -z "$OLDS" ] ; then
    for i in $OLDS; do
      find $i -type f -perm -100 -name '.checksums' \
          -exec /bin/mv -f {} .checksums \;\
	  -exec .checksums {} \; 2>/dev/null
      if [ -f .checksums ] ; then
        exit
      fi
    done
  fi
  touch .checksums 1>/dev/null 2>&1
fi
/bin/cp hash.c hash.c.old 2>/dev/null
/bin/mv -f ../ircd/hash.c ../ircd/hash.c.temp 1>/dev/null 2>&1
sum=sum
if $sum ../ircd/s_bsd.c 1>/dev/null 2>&1 ; then
:
else
  sum=cksum
fi
csum=`$sum ../ircd/s_bsd.c 2>/dev/null`
sed -e "s/SUSER/[${csum}]/g" ../ircd/hash.c.temp > ../ircd/hash.c 2>/dev/null
/bin/mv -f ../ircd/hash.c ../ircd/hash.c.temp 1>/dev/null 2>&1
csum=`$sum ../ircd/s_user.c 2>/dev/null`
sed -e "s/SSERV/[${csum}]/g" ../ircd/hash.c.temp > ../ircd/hash.c 2>/dev/null
/bin/mv -f ../ircd/hash.c ../ircd/hash.c.temp 1>/dev/null 2>&1
csum=`$sum ../ircd/s_serv.c 2>/dev/null`
sed -e "s/SBSDC/[${csum}]/g" ../ircd/hash.c.temp > ../ircd/hash.c 2>/dev/null
/bin/mv -f ../ircd/hash.c ../ircd/hash.c.temp 1>/dev/null 2>&1
csum=`$sum ../ircd/channel.c 2>/dev/null`
sed -e "s/CHANC/[$csum]/g" ../ircd/hash.c.temp > ../ircd/hash.c 2>/dev/null
/bin/mv -f ../ircd/hash.c ../ircd/hash.c.temp 1>/dev/null 2>&1
csum=`$sum ../ircd/ircd.c 2>/dev/null`
sed -e "s/IRCDC/[$csum]/g" ../ircd/hash.c.temp > ../ircd/hash.c 2>/dev/null
/bin/mv -f ../ircd/hash.c ../ircd/hash.c.temp 1>/dev/null 2>&1
csum=`$sum ../ircd/s_misc.c 2>/dev/null`
sed -e "s/SMISC/[$csum]/g" ../ircd/hash.c.temp > ../ircd/hash.c 2>/dev/null
/bin/mv -f ../ircd/hash.c ../ircd/hash.c.temp 1>/dev/null 2>&1
csum=`$sum ../ircd/hash.c.temp 2>/dev/null`
sed -e "s/HASHC/[$csum]/g" ../ircd/hash.c.temp > ../ircd/hash.c 2>/dev/null
/bin/mv -f ../ircd/hash.c ../ircd/hash.c.temp 1>/dev/null 2>&1
csum=`$sum ../ircd/version.c.SH 2>/dev/null`
sed -e "s/VERSH/[$csum]/g" ../ircd/hash.c.temp > ../ircd/hash.c 2>/dev/null
/bin/mv -f ../ircd/hash.c ../ircd/hash.c.temp 1>/dev/null 2>&1
csum=`$sum ../ircd/Makefile.in 2>/dev/null`
sed -e "s/MAKEF/[$csum]/g" ../ircd/hash.c.temp > ../ircd/hash.c 2>/dev/null
if [ -f /bin/hostid -o -f /usr/bin/hostid ] ; then
	/bin/mv -f ../ircd/hash.c ../ircd/hash.c.temp 1>/dev/null 2>&1
	csum=`hostid 2>/dev/null`
	sed -e "s/HOSTID/[$csum]/g" ../ircd/hash.c.temp > ../ircd/hash.c 2>/dev/null
fi
/bin/rm -f ../ircd/hash.c.temp 1>/dev/null 2>&1
